﻿/// ****************************************************************************
/// Author:	        Robin Zhu
/// Create Date:	2012-4-16
/// Purpose: 		验证配置节
/// ****************************************************************************
/// Modify By		Date			Remark
/// Robin           2012-5-18       加入CookieTimeOut属性，作为Cookie过期天数
/// ****************************************************************************
/// 
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;

namespace RB.Web.Security
{
    /// <summary>
    /// 验证配置节
    /// </summary>
    public class VarAuthenticationSection : ConfigurationSection
    {
        [ConfigurationProperty("serviceType", IsRequired = true)]
        public string ServiceType
        {
            get
            {
                return (string)this["serviceType"];
            }
            set
            {
                this["serviceType"] = value;
            }
        }

        [ConfigurationProperty("loginUrl", DefaultValue = "/Account/LogOn", IsRequired = false)]
        public string LoginUrl
        {
            get
            {
                return (string)this["loginUrl"];
            }
            set
            {
                this["loginUrl"] = value;
            }
        }

        [ConfigurationProperty("cookieDomain", DefaultValue="", IsRequired = false)]
        public string CookieDomain
        {
            get
            {
                return (string)this["cookieDomain"];
            }
            set
            {
                this["cookieDomain"] = value;
            }
        }

        [ConfigurationProperty("cookiePath", DefaultValue = "/", IsRequired = false)]
        public string CookiePath
        {
            get
            {
                return (string)this["cookiePath"];
            }
            set
            {
                this["cookiePath"] = value;
            }
        }

        [ConfigurationProperty("cookieName", DefaultValue = ".RBAUTH", IsRequired = false)]
        public string CookieName
        {
            get
            {
                return (string)this["cookieName"];
            }
            set
            {
                this["cookieName"] = value;
            }
        }

        /// <summary>
        /// Cookie过期天数
        /// </summary>
        [ConfigurationProperty("cookieTimeOut", DefaultValue = 30, IsRequired = false)]
        public int CookieTimeOut
        {
            get
            {
                return (int)this["cookieTimeOut"];
            }
            set
            {
                this["cookieTimeOut"] = value;
            }
        }
    }
}
